package com.settlement.system.service.impl;

import com.settlement.system.mapper.WpPlugInMapper;
import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.CommonPlugIn;
import com.settlement.system.model.entity.common.SinglePage;
import com.settlement.system.service.IWpPlugInService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author author
 */
@Slf4j
@Service
public class WpPlugInServiceImpl implements IWpPlugInService {

    @Resource
    private WpPlugInMapper wpPlugInMapper;

    /**
     * 获取账单的数量
     * @param params
     * @return
     * @throws ServiceException
     */
    @Override
    public Integer getBillNumberCount(Map<String, Object> params) throws ServiceException {
        try{
            return wpPlugInMapper.getBillNumberCount(params);
        } catch (Exception ex){
            throw new ServiceException("获取账单的数量异常",ex);
        }
    }

    /**
     * 获取账单
     * @param page
     * @param params
     * @param orderByField
     * @param orderBy
     * @return
     * @throws ServiceException
     */
    @Override
    public List<CommonPlugIn> getBillNumber(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return wpPlugInMapper.getBillNumber(page,params,orderByField,orderBy);
        } catch (Exception ex){
            throw new ServiceException("获取账单异常",ex);
        }
    }

    /**
     * 获取结算期间的数量
     * @param param
     * @return
     * @throws ServiceException
     */
    @Override
    public Integer getSettlePeriodCount(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getSettlePeriodCount(param);
        } catch (Exception ex){
            throw new ServiceException("获取结算期间的数量异常",ex);
        }
    }

    /**
     * 获取结算期间
     * @param page
     * @param params
     * @param orderByField
     * @param orderBy
     * @return
     * @throws ServiceException
     */
    @Override
    public List<CommonPlugIn> getSettlePeriod(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return wpPlugInMapper.getSettlePeriod(page,params,orderByField,orderBy);
        } catch (Exception ex){
            throw new ServiceException("获取结算期间",ex);
        }
    }

    /**
     * 获取档期的数量
     * @param param
     * @return
     * @throws ServiceException
     */
    @Override
    public Integer getCalendarCount(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getCalendarCount(param);
        } catch (Exception ex){
            throw new ServiceException("获取结算期间的数量异常",ex);
        }
    }

    /**
     * 获取档期
     * @param page
     * @param params
     * @param orderByField
     * @param orderBy
     * @return
     * @throws ServiceException
     */
    @Override
    public List<CommonPlugIn> getCalendar(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return wpPlugInMapper.getCalendar(page,params,orderByField,orderBy);
        } catch (Exception ex){
            throw new ServiceException("获取结算期间",ex);
        }
    }

    /**
     * 获取档期的数量
     * @param param
     * @return
     * @throws ServiceException
     */
    @Override
    public Integer getOrderScheduleCount(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getOrderScheduleCount(param);
        } catch (Exception ex){
            throw new ServiceException("获取结算期间的数量异常",ex);
        }
    }

    /**
     * 获取档期
     * @param page
     * @param params
     * @param orderByField
     * @param orderBy
     * @return
     * @throws ServiceException
     */
    @Override
    public List<CommonPlugIn> getOrderSchedule(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return wpPlugInMapper.getOrderSchedule(page,params,orderByField,orderBy);
        } catch (Exception ex){
            throw new ServiceException("获取结算期间",ex);
        }
    }

    /**
     * 获取店铺
     * @param param
     * @return
     * @throws ServiceException
     */
    @Override
    public List<CommonPlugIn> getShop(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getShop(param);
        } catch (Exception ex){
            throw new ServiceException("获取店铺异常",ex);
        }
    }

    /**
     * 获取公司
     * @param param
     * @return
     * @throws ServiceException
     */
    @Override
    public List<CommonPlugIn> getCompany(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getCompany(param);
        } catch (Exception ex){
            throw new ServiceException("获取公司异常",ex);
        }
    }

    @Override
    public List<CommonPlugIn> getBillTypeList(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getBillTypeList(param);
        } catch (Exception ex){
            throw new ServiceException("获取账单编码异常",ex);
        }
    }

    @Override
    public List<CommonPlugIn> getBillCategoryList(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getBillCategoryList(param);
        } catch (Exception ex){
            throw new ServiceException("获取账单大类异常",ex);
        }
    }

    @Override
    public List<CommonPlugIn> getBillCategoryInUseList(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getBillCategoryInUseList(param);
        } catch (Exception ex){
            throw new ServiceException("获取账单大类异常",ex);
        }
    }

    @Override
    public List<CommonPlugIn> getBillTypeListAll(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getBillTypeListAll(param);
        } catch (Exception ex){
            throw new ServiceException("获取账单编码异常",ex);
        }
    }

    @Override
    public List<CommonPlugIn> searchChannelList(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.searchChannelList(param);
        } catch (Exception ex){
            throw new ServiceException("获取渠道异常",ex);
        }
    }

    @Override
    public List<CommonPlugIn> searchCategoryList(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.searchCategoryList(param);
        } catch (Exception ex){
            throw new ServiceException("获取渠道异常",ex);
        }
    }

    @Override
    public List<CommonPlugIn> searchQueryTableList(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.searchQueryTableList(param);
        } catch (Exception ex){
            throw new ServiceException("获取联表查询表列表异常",ex);
        }
    }

    @Override
    public List<CommonPlugIn> getVoucherTypeList(Map<String, Object> param) throws ServiceException {
        try{
            return wpPlugInMapper.getVoucherTypeList(param);
        } catch (Exception ex){
            throw new ServiceException("获取账单编码异常",ex);
        }
    }


}
